package com.softdev.pojo;

import com.softdev.common.AbstractBaseEntity;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.persistence.*;
import java.io.Serializable;
import java.util.List;

@ApiModel("项目模块")
@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "modules")
public class Module extends AbstractBaseEntity implements Serializable {

    private static final long serialVersionUID = 2150762334665131085L;

    @Column(name = "name")
    private String name;

    @Column(name = "cur")
    private Integer cur;

    @ManyToMany(fetch = FetchType.EAGER , cascade = CascadeType.PERSIST)
    @JoinTable(name = "modules_users" ,
            joinColumns = {@JoinColumn(name = "module_id")} ,
            inverseJoinColumns = {@JoinColumn(name = "user_id")})
    private List<User> users;

}
